perm filename PAGE39[00,BGB] blob sn#047830 filedate 1973-06-07 generic text, type T, neo UTF8
~F8SAIL INTERFACING TO CRE.

	It should be possible to embed the CRE machine code  under  a
SAIL  core  image;  however  I do not intend to do this work. For the
present, the CRE interface to SAIL is only realized via a  disk  file
transfer  of  the  data  structure.   A  CRE file may be read into an
integer array in binary mode as illustrated below.

	The  first  word  of a CRE file is the first word of the film
node which contains the size of the file in words. The film node  has
address  0;  the  next node has address 7; and so on in multiplies of
seven.  There are no empty nodes in a CRE file.  The  following  SAIL
program will read in a CRE file named X:

	COMMENT EXAMPLE OF SAIL INPUT OF A CRE FILE;
	BEGIN	"TEST"
		INTEGER SIZE;
		OPEN(1,"DSK",8,3,0,0,0,0);
		LOOKUP(1,"X.CRE",0);
		SIZE ← WORDIN(1);
	BEGIN
		INTEGER ARRAY NODE[0:SIZE];
		ARRYIN(1,NODE[1],SIZE-1);
		RELEASE(1);
		"MAIN PROGRAM.";
	END;
	END;

After the NODE array is loaded, CRE links and data may be accessed by
their  document names in a reasonible node-link notation using macros
like the following:

	DEFINE CW(Q)  = "(NODE[Q] LSH -18)";
	DEFINE CCW(Q) = "(NODE[Q] LAND '777777)";
	DEFINE DAD(Q) = "(NODE[Q+1] LSH -18)";
	DEFINE SON(Q) = "(NODE[Q+1] LAND '777777)";

So  that  the first vertex of the first polygon of the first level of
the first image of the film can be obtained:

	INTEGER FILM,IMAGE,LEVEL,POLYGON,VERTEX;

	FILM ← NODE[0];
	LEVEL ← SON(FILM);
	POLYGON ← SON(LEVEL);
	VERTEX ← SON(POLYGON);

The  user may note that SAIL will compile three or more instructuions
for what is known as a PDP-10 halfword operation; also  if  the  user
converts  the  CRE  nodes  and links into LEAP items and associations
then an  overhead  of  from  ten  to  one  hundred  instructions  per
"halfword operation" will be incurred.
~I1973,800;F8- 39 -